﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

namespace GMAC.ReportingSystem.UserControls
{
    public partial class wucFileUpload : System.Web.UI.UserControl
    {
        public string FileName
        {
            get
            {
                return this.hidFilename.Value;
            }
        }

        public string Extensions { get; set; }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!this.IsPostBack)
            {
                this.upload1.Attributes["onchange"] = "fileUpload_OnChange(this,'" + this.ClientID + "');";
               // this.imgDeleteAttachment.Attributes["onclick"] = "DeleteAttachment('" + this.ClientID + "');";
                this.hidExtensions.Value = this.Extensions;
            }
        }

        public void SaveFile(string filename)
        {
            //if (!string.IsNullOrEmpty(path) && this.upload1.HasFile)
            //{
            //    if (path.Length > 1 && path.Substring(path.Length - 1, 1) != @"\")
            //    {
            //        path += @"\";

            //    }
            //}
            this.upload1.SaveAs(filename);
        }
    }
}